/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-03-25
 * Time: 16:31
 */
public class Thread1 {
    public static class MyThread extends Thread{
        @Override
        public void run() {
          while (true){
              try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              }
              System.out.println("新线程");
          }
        }
    }
    public static void main(String[] args) {
        MyThread t=new MyThread();
        t.start();
        while (true){
            System.out.println("Main线程");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
